import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TeachPlanVO, TeachPlanForm, TeachPlanQuery } from '@/api/core/teachPlan/types';

/**
 * 查询实验教学计划列表
 * @param query
 * @returns {*}
 */

export const listTeachPlan = (query?: TeachPlanQuery): AxiosPromise<TeachPlanVO[]> => {
  return request({
    url: '/core/teachPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实验教学计划详细
 * @param id
 */
export const getTeachPlan = (id: string | number): AxiosPromise<TeachPlanVO> => {
  return request({
    url: '/core/teachPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增实验教学计划
 * @param data
 */
export const addTeachPlan = (data: TeachPlanForm) => {
  return request({
    url: '/core/teachPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改实验教学计划
 * @param data
 */
export const updateTeachPlan = (data: TeachPlanForm) => {
  return request({
    url: '/core/teachPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除实验教学计划
 * @param id
 */
export const delTeachPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/core/teachPlan/' + id,
    method: 'delete'
  });
};
